<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>店家的分店</title>
    <meta name="viewport" content="width = device-width , initial-scale = 1 , minimum-scale = 1 , maximum-scale = 1 , user-scalable = no">
    <link rel="stylesheet" href="../../resource/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../resource/css/common.css">
    <link rel="stylesheet" href="../../resource/css/style.css">
</head>
<body>
<div id="header">
    <a class="to_position back">&#xe732;返回</a>
</div>

<div class="jifen_store"></div>

<!--模态框-->
<div class="modal fade position_change" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body"></div>
            <div class="modal-footer">
                <button type="button" class="sanFast-btn"
                        data-dismiss="modal">返回
                </button>
                <button type="button" class="sanFast-btn release">
                    去登录
                </button>
            </div>
        </div>
    </div>
</div>

<script src="../../resource/js/jquery.min.js"></script>
<script src="../../resource/js/bootstrap.min.js"></script>
<script src="../../resource/js/commonjs.js"></script>
<script src="../../resource/js/ReceiveAndConvert.js"></script>
<script src="http://api.map.baidu.com/api?v=2.0&ak=qVrWQw9Vs8t7iPfG7bSj0137" type="text/javascript"></script>
<script>
    $(function(){
        init();
    })
    function init(){
        var url="/shops/getShopsUserCouponList";
        var shop_id=getArg("shop_id");
        var arg = {};
        arg.shop_id=shop_id;
        ajaxJsonp(url, arg, initShop);
    }
    function initShop(res){
        var shop_info = res.data.shop_info;
        var business_name = shop_info.business_name;
        $("#header").append('<h1 style="margin-left: -50px;">'+business_name+'</h1>')
        var image = shop_info.image;
        var name = shop_info.name;
        var label= shop_info.label_list;
        var juli=getArg("distance");
        var list=res.data.coupon_list;
        if(list.length==0){
            $(".jifen_store").append("<div class='noCoupon'>该店铺没有个人发布的优惠券！</div>");
        }else{
            for(var j=0;j<list.length;j++){
                var remark=list[j].remark;
                var user_name=list[j].user_name;
                var credit=list[j].credit;
                var discount=list[j].discount;
                var id=list[j].id;
                var s_time = list[j].start_time;  //开始时间
                var e_time = list[j].expired_time;  //结束时间
                var start_time=timeChange(s_time).substr(2, 7);
                var end_time=timeChange(e_time).substr(2, 7);
                var coupon_code=list[j].coupon_code;
                var coupon_list_1='<div class="index_stores">'+
                                    '<div class="store_detail">'+
                                        '<div><label class="label_8">'+discount+'</label><img src='+image+'></div>'+
                                        '<ul>'+
                                            '<li>'+business_name+'('+name+')</li>'+
                                            '<li>'+label[0]+' '+label[1]+' '+label[2]+' '+label[3]+'</li>'+
                                            '<li>'+juli+'</li>'+
                                            '<li>'+start_time+'-'+end_time+'</li>'+
                                        '</ul>'+
                                    '</div>'+
                                    '<div class="pinjia">'
                if(remark==''||user_name==''||user_name==undefined||remark==undefined){
                    var coupon_list_2='<div class="discuss"></div>'+ '<p>'+
                                        '<span class="user_jifen">'+credit+'积分 </span>'+
                                        '<span data-id="'+coupon_code+'" class="'+credit+'" onclick= "convert_2(this,otherLinkLogin)"> 兑换</span>'+
                                      '</p></div></div>'
                }else{
                    var coupon_list_2='<div class="discuss">'+'<div class="discuss_hidden"><span class="username">'+user_name+'</span>'+'说：'+remark+'</div>'+ '</div>'+
                                      '<p>'+
                                        '<span class="user_jifen">'+credit+'积分 </span>'+
                                        '<span data-id="'+coupon_code+'" class="'+credit+'" onclick= "convert_2(this,otherLinkLogin)"> 兑换</span>'+
                                      '</p></div></div>'
                }
                $(".jifen_store").append(coupon_list_1+coupon_list_2);
            }
        }
    }
</script>
</body>
</html>